home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 159
/
159.d81
/
b.crypto results
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
16KB
|
386 lines
10 rem solving knees calhoon's crypto challenge from loadstar 156
20 rem tom lawless / 229 dogwood lane / maynardville, tn 37807 / june 1997
30 poke53771,0:rem 20mhz if supercpu
40 c$=chr$(147):h$=chr$(19):b$=chr$(31):r$=chr$(28):o$=chr$(18):f$=chr$(146)
50 d$=chr$(17):u$=chr$(145):l$=chr$(157):i$=chr$(29):a$="":j$="":z$=""
60 g$=r$+"[184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"+b$:e$=r$+"[185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185]"+b$
70 m$="-------------------":s$=o$+" "
80 n$="----------- ---------- -----------":print c$chr$(14);
90 poke 53280,15:poke 53281,15:d=230:dim c(39):for k=1 to 39:c(k)=-1:next
100 dim i(d),n(d),o(d),t(d),w(d),l(d),v(d),f(d),s(d),x(d),g(d),h(d),r(d),u(d)
110 :
120 print r$"[184]"g$g$,b$" 1. [207]+[206]+[197] = 1 [211][207][204][214][201][206][199]"
130 print m$" [203][206][197][197][211][160][195][193][204][200][207][207][206]'[211]"
140 print" 2. [212]+[215]+[207] = 2 [195][210][217][208][212][207][160][195][200][193][204][204][197][206][199][197]",m$i$e$
150 print" 3. [212]+[200]+[210]+[197]+[197] = 3 "s$,f$m$i$o$" [211]olve this system "
160 print" 4. [198]+[207]+[213]+[210] = 4 "s$,f$m$i$o$" of equations over "
170 print" 5. [198]+[201]+[214]+[197] = 5 "s$,f$m$i$o$" the integers from "
180 print" 6. [211]+[201]+[216] = 6 "s$,f$m$i$o$" -19 to 19, inclu- "
190 print" 7. [211]+[197]+[214]+[197]+[206] = 7 "s$,f$m$i$o$" sive, with no two "
200 print" 8. [197]+[201]+[199]+[200]+[212] = 8 "s$,f$m$i$o$" variables having "
210 print" 9. [206]+[201]+[206]+[197] = 9 "s$,f$m$i$o$" the same value. "
220 print"10. [212]+[197]+[206] = 10 "s$,f$m$i$g$
230 print"11. [197]+[204]+[197]+[214]+[197]+[206] = 11 "r$"<[195]> [195]ontinue"b$
240 print m$"- "r$"<[208]> [208]rint"b$
250 print"12. [212]+[215]+[197]+[204]+[214]+[197] = 12 "r$"<[212]> [212]ab 40 [208]rint"b$
260 print e$r$"[185] <[209]> [209]uit"b$h$:gosub 5000
270 :
490 rem method
500 print c$tab(17)"[205][197][212][200][207][196]":print i$e$e$,i$s$s$,i$;
510 print" 1. [211]elect value of [197]. ([213]ser input) ",i$s$s$,i$;
520 print" 2. [212][193][194][204][197] 1: 1 row for each [201] value. ",i$;
530 print" [197]valuate [206],[207],[212],[215] on each row. ",i$;
540 print" [196]iscard rows w/forbidden values. ",i$s$s$,i$;
550 print" 3. [212][193][194][204][197] 2: [213]se all [204] values with ",i$;
560 print" each row of [212][193][194][204][197] 1. [197]valuate ",i$;
570 print" [214],[198],[211],[216]. [196]iscard rows as before. ",i$s$s$,i$;
580 print" 4. [212][193][194][204][197] 3: [213]se all [199] values with ",i$;
590 print" each row of [212][193][194][204][197] 2. [197]valuate ",i$;
600 print" [200],[210],[213]. [196]iscard rows as before. ",i$s$s$,i$;
610 print" 5. [196]isplay solutions. [210]eturn to 1. ",i$s$s$,i$f$g$g$
620 print" [197] ="e;tab(8)"<"r$"+"b$"/"r$"-"b$">[211]elect [207]ne [197] [214]alue <"r$"[200]"b$">"
630 print" <"r$"\"b$">[211]olve--[212]his [197]--[215]ork [211]creens [200]elp"
640 print" <"r$"^"b$">[211]olve--[212]his [197]--[199]auge [211]creen -----"
650 print" <"r$"*"b$">[211]olve--[193]ll [197]'s-[199]auge [211]creen <[208]/[212]>"
660 print" <"r$"_"b$">[193]ssume [211]ummary [196]ata--[212]his [197] <[209]>"u$u$u$u$
670 poke 650,128
680 get q$:if q$="q" then 40000
690 if q$="p"or q$="t"then gosub 9000:goto 680
695 if q$="h" then gosub 4000:goto 500
700 if q$="\"then c=0:goto 830
710 if q$="^"then c=-1:goto 830
720 if q$="*"then c=1:e=-19:goto 830
730 if q$<>"_" then 790
740 poke 53280,3:poke 53281,3
750 for k=1 to e+20:read z:next:restore
760 c=0:goto 2200
770 data 0,0,0,0,0,0,6,22,40,77,51,125,125,151,199,226,103,139,199,142
780 data 160,92,182,0,122,57,82,125,109,75,63,69,33,18,8,7,1,0,0
790 if q$<>"+"and q$<>"-"then 680
800 if q$="+"then e=e+1:if e=20 then e=-19
810 if q$="-"then e=e-1:if e=-20 then e=19
820 print tab(4)u$" "l$l$l$e;b$:goto 680
830 poke 650,0:if c=0 then 940
840 if c=-1 then 930
850 :
890 rem table 1
900 if c(e+20)=-1 then 930
910 if e=19 then poke 53280,7:poke 53281,7:goto 2200
920 e=e+1:goto 900
930 print c$d$d$r$tab(9)"[197] ="e,,,d$b$"[212][193][194][204][197] 1: "r$"[201] [206] [207] [212] [215]"b$:goto 1060
940 print c$;:gosub 3030
950 print" 1. [207]+[206] ="1-e:print" 2. [212]+[215]+[207] = 2":print" 3. [212]+[200]+[210] ="3-2*e
960 print" 4. [198]+[207]+[213]+[210] = 4":print" 5. [198]+[201]+[214] ="5-e:print" 6. [211]+[201]+[216] = 6"
970 print" 7. [211]+[214]+[206] ="7-2*e:print" 8. [201]+[199]+[200]+[212] ="8-e:print" 9. 2[206]+[201] ="9-e
980 print"10. [212]+[206] ="10-e:print"11. [204]+[214]+[206] ="11-3*e:print m$l$" "
990 print" 9. [206] =("9-e"-[201])/2":print" 1. [207] ="1-e"-[206]"
1000 print"10. [212] ="10-e"-[206]":print" 2. [215] = 2-[212]-[207]"
1010 print e$l$" ":print o$"[201] _ [206] _ [207] & [212] _ [215] "
1020 print o$"[213]se all [201] values: ",,,"-19 < = [201] < = +19 ":print g$l$" "
1030 print h$tab(19)r$"[185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185]"b$,tab(19)
1040 print o$" [201] "i$" [206] "i$" [207] "i$" [212] "i$" [215] ",tab(19)
1050 print f$r$"[184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184]"b$,tab(20)"/ / / / /"u$
1060 z=0:for i=-19 to 19
1070 n=(9-e-i)/2:if n<-19 or n>19 or n=i or n=e or n<>int(n) then 1120
1080 o=1-e-n:if o<-19 or o>19 or o=n or o=i or o=e then 1120
1090 t=10-e-n:if t<-19 or t>19 or t=n or t=i or t=e then 1120
1100 w=2-t-o:if w<-19 or w>19 or w=n or w=i or w=e then 1120
1110 z=z+1:i(z)=i:n(z)=n:o(z)=o:t(z)=t:w(z)=w
1120 next
1130 if c<>0 then 1200
1140 for k=1 to z:print tab(19)i(k)tab(23)n(k)tab(27)o(k)tab(31)t(k)tab(35)w(k)
1150 next:print tab(19)m$,tab(19)"[212][193][194][204][197] 1: [193]ll rows"
1160 print tab(19)"with invalid values",tab(19)"have been discarded"
1170 print tab(19)m$,tab(25)"<[195]> <[208]/[212]> <[209]>":gosub 5000
1180 :
1190 rem table 2
1200 a=1:j=1:if c=0 then 1230
1210 print d$"[212][193][194][204][197] 2: "r$"[204] [214] [198] [211] [216]"b$:for k=1to z:print".";:next:print u$
1220 print"[162]";:goto 1250
1230 gosub 2990:gosub 3020:print tab(21)u$"/ / / / /"
1240 gosub 3030:gosub 3040
1250 k=j-1:forl=-19to19:ifl=w(j)orl=t(j)orl=o(j)orl=n(j)orl=i(j)or l=e then1350
1260 v=11-3*e-n(j)-l:if v<-19 or v>19 or v=l or v=e then 1350
1270 if v=w(j) or v=t(j) or v=o(j) or v=n(j) or v=i(j) then 1350
1280 f=5-e-i(j)-v:if f<-19 or f>19 or f=v or f=l or f=e then 1350
1290 if f=w(j) or f=t(j) or f=o(j) or f=n(j) or f=i(j) then 1350
1300 s=7-2*e-n(j)-v:if s<-19 or s>19 or s=f or s=v or s=l or s=e then 1350
1310 if s=w(j) or s=t(j) or s=o(j) or s=n(j) or s=i(j) then 1350
1320 x=6-i(j)-s:if x<-19 or x>19 or x=s or x=f or x=v or x=l or x=e then 1350
1330 if x=w(j) or x=t(j) or x=o(j) or x=n(j) or x=i(j) then 1350
1340 k=k+1:l(k)=l:v(k)=v:f(k)=f:s(k)=s:x(k)=x
1350 next:if c=0 then 1390
1360 gosub 2810:if j<=z then 1220
1370 if z=0 then 2200
1380 print d$d$:for i=1 to z:print".";:next:print h$d$d$d$d$d$d$d$d$:goto1600
1390 if k<j then 1460
1400 for i=j to k:x$=left$(str$(x(i)),3):if i<>j+19 then 1440
1410 print tab(20)m$,tab(21)"[205]ore <[195]> <[208]/[212]> <[209]>":gosub 5000
1420 gosub 2990:gosub 3020:gosub 3030:gosub 3040
1430 print tab(20)m$,tab(21)"[195]ontinued",tab(20)m$
1440 print tab(20)l(i)tab(24)v(i)tab(28)f(i)tab(32)s(i)tab(36)x$
1450 next
1460 gosub 2810:if z=0 then 2200
1470 gosub 2930:if j<=z then 1230
1480 :
1490 rem table 2 display
1500 for j=1 to z:if (j-1)/20>int((j-1)/20) then 1520
1510 gosub 2990:a=j
1520 gosub 3020:gosub 3130
1530 if j/20>int(j/20) and j<z then 1560
1540 b=j:print"-"m$m$,"[197]="e;l$":[212][193][194][204][197] 2:"a"-"b"/"z;tab(28)
1550 print r$"<[195]><[208]/[212]><[209]>"u$b$:gosub 5000
1560 next
1570 :
1590 rem table 3
1600 a=0:j=1:if c=0 then 1630
1610 print"[212][193][194][204][197] 3: "r$"[199] [200] [210] [213]"b$
1620 print"[162]";:goto 1720
1630 gosub 2990:gosub 3020:gosub 3130:gosub 3030
1640 print" 3. [200]+[210] ="3-2*e-t(j):print" 4. [213]+[210] ="4-o(j)-f(j)
1650 pri